<template>
  <!-- 顶部 -->
  <div class="nav_record_wrap">
    <div class="nav_home">
      <router-link to="Home">
        <van-icon name="wap-home-o" />
      </router-link>
    </div>
    <div class="nav_text">
      <router-link to="Home">
        网易严选
      </router-link>
    </div>
    <div class="nav_icon">
      <div class="nav_icon_seceh">
        <van-icon name="search" />
      </div>
      <div class="nav_icon_cart">
        <router-link to="Cart">
          <van-icon name="cart-o" badge="99"/> 
        </router-link>
      </div>
    </div>
  </div>

  <!-- 地址管理 -->
  <!-- @click="toEditAddress" -->
  <router-link to="/addressList">
    <div class="address" >
    <div class="address_bg"></div>
    <!-- 用户没有默认地址 -->
    <!-- <div class="noAddress">
    </div> -->
    <!-- 用户有默认地址 -->
    <div class="address_content">
      <div class="address_item">
        <div class="info">
          <text class="username">浪迹天涯</text>&nbsp;&nbsp;
          <text class="phone">13855555555</text>
        </div>
        <div class="address_title">北京市昌平区</div>
        <div class="address_full">宏福科技园北楼小黄楼</div>
      </div>
      <van-icon color="#BBBBBB" name="arrow" size="22px" />
    </div>
  </div>
  </router-link>
    
  

  <!-- 优惠券 -->
  <ul class="m-list m-discount">
    <li class="item">
      <div class="m-listItem f-clearfix">
        <div class="inner">
          <div class="selectCoupon">
            <div class="left">暂无可用优惠券</div>
            <div class="right">
              <div class="text">2张</div>
            </div>
          </div>
        </div> 
        <van-icon name="arrow" /> 
      </div>
    </li>
    <li class="item">
      <div>
        <div class="m-listItem undefined">
          <div class="inner">
            <div class="m-lineWithCheckbox giftCardDesc-wrapper">
              <van-checkbox v-model="checked" shape="square" disabled></van-checkbox>
              <div class="txt">
                <div>礼品卡余额：¥0.00</div>
                <div class="giftCardDesc"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </li>
    <li class="item">
      <div>
        <div class="m-listItem undefined">
          <div class="inner">
            <div class="m-lineWithCheckbox giftCardDesc-wrapper">
              <van-checkbox v-model="checked" shape="square" disabled></van-checkbox>
              <div class="txt">
                <div>余额：¥0.00</div>
                <div class="giftCardDesc"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </li>
  </ul>

  <!-- 商品合计 -->
  <ul class="goodsCount">
    <li class="item">
      <div class="item_list">
        <div class="inner">
          <div class="left">商品合计</div>
          <div class="right">￥378.00</div>
        </div>
        
      </div>
    </li>
    <li class="item">
      <div class="item_list">
        <div class="inner">
          <div class="left">邮费</div>
          <div class="right">￥0.00</div>
        </div>
        
      </div>
    </li>
    <li class="item">
      <div class="item_list">
        <div class="inner">
          <div class="left">活动优惠</div>
          <div class="right">-￥209.00</div>
        </div>
        
      </div>
    </li>
    <li class="item">
      <div class="item_list">
        <div class="inner">
          <div class="left">优惠券</div>
          <div class="right">-￥0.00</div>
        </div>
        
      </div>
    </li>
    <li class="item">
      <div class="item_list">
        <div class="inner">
          <van-checkbox v-model="checked" shape="square"></van-checkbox>
          <div class="left">我要开发票</div>
        </div>
        
      </div>
    </li>
  </ul>
  
  <!-- 提交订单 -->
  <van-submit-bar :price="3050" button-text="提交订单" @submit="onSubmit" />

  
</template>

<script setup lang="ts">
import {ref} from 'vue'
import { showToast } from 'vant';
import { useRouter } from "vue-router";
const router = useRouter();
// 自定义数据
const checked = ref(false);

// 自定义事件回调

// 提交订单
const onSubmit = () => showToast('点击按钮');

</script>

<style scoped lang="less">
*{
  box-sizing: border-box;
  background-color: #fafafa;
}
a{
  color: #000;
}

// 导航
.nav_record_wrap{
    display: flex;
    text-align: center;
    height: 44px;
    line-height: 44px;
    justify-content: space-between;
    padding: 0 10px;
    .nav_home{
      font-size: 24px;
    }
    .nav_text{
      font-size: 18px;
      font-weight: bolder;
      a{
        color: #333;
      }
    }
    .nav_icon{
    display: flex;
    font-size: 32px;
    .nav_icon_seceh{
      padding-right: 10px;
      .van-icon{
        font-size: 28px;
      }
    }
    .nav_icon_cart{
      .van-icon{
        font-size: 28px;
        padding-right: 8px;
      }
    }
  }
}

// 地址管理
.address {
  border-bottom: 10px solid #fff;
  .address_bg {
    width: 100%;
    height: 5px;
    background-color: #fff;
    background-image: url(https://yanxuan-static.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-67880192dc.png?imageView&type=webp);
    background-repeat: repeat-x;
    display: block;
  }

  .address_content {
    font-size: 14px;
    display: flex;

    .address_item {
      margin: 20px;
      margin-right: 70px;

      .info {
        color: #666;
        margin-bottom: 5px;

      }

      .address_title {
        font-size: 40rpx;
        font-weight: bold;
      }
      .address_full{
        font-size: 15px;
        font-weight: 400;
        line-height: 30px;
      }
    }

    .van-icon {
      margin-top: 45px;
      padding-left: 95px;
    }

  }
}

// 优惠券
.m-list{
  display: block;
  padding-left: 15px;
  .item{
    width: 100%;
    position: relative;
    .m-listItem{
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      position: relative;
      min-height: 52px;
      padding-right:40px ;
      .inner{
        width: 100%;
        zoom: 1;
        .selectCoupon{
          zoom: 1;
          color: #666;
          font-size: 14px;
          .left{
            float: left;
          }
          .right{
            float: right;
          }
        }
        .giftCardDesc-wrapper{
          display: flex;
          align-items: center;
          font-size: 14px;
          line-height: 19px;
          .van-checkbox{
            margin-right: 8px;
            width: 18px;
            height: 18px;
          }
          .txt{
            color: #ccc;
          }
        }

      }
      // icon
      .van-icon {
        font-size: 14px;
        position: absolute;
        right: 8px;
      }
    }
    ::after{
      content: '';
      position: absolute;
      background-color: #d9d9d9;
      left: 0;
      width: 100%;
      height: 1px;
      transform-origin: 50% 100% 0;
      bottom: 0;
    }
    
  }

  li{
    list-style: none;
  }
}

// 商品合计
.goodsCount{
  width: 375px;
  height: 260px;
  margin-top: 15px;
  display: block;
  padding-left: 15px;
  .item{
    position: relative;
    .item_list{
      padding: 12.5px 15px 12.5 0;
      line-height: 25px;
      font-size: 14px;
      color: #333;
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      position: relative;
      min-height: 52px;
      .inner{
        width: 100%;
        .van-checkbox{
          float: left;
          margin-right: 8px;
        }
        .left{
          float: left;
        }
        .right{
          float: right;
          margin-right: 15px;
        }
      }
      
    }
    ::after{
      content: '';
      position: absolute;
      background-color: #d9d9d9;
      left: 0;
      width: 100%;
      height: 1px;
      transform-origin: 50% 100% 0;
      bottom: 0;
    }
  }

}

// 提交订单
.van-submit-bar{
  margin-bottom: 5px;
}

// 深度作用选择器--徽标
::v-deep .van-badge--top-right {
  transform: translate(25%,-25%);
}

</style>